package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;

public class OrderOperation {
	private Connection conn;
	private PreparedStatement infoQuery;
	public void saveOrder(Userinfo bookorder) {
		try {
		conn=DBcon.getConnection();
		String sql="insert into bookorder (username,zipcode,phone,creditcard,address,total) values(?,?,?,?,?,?)";
		infoQuery=conn.prepareStatement(sql);
		infoQuery.setString(1,bookorder.getUsername());
		infoQuery.setString(2,bookorder.getZipcode());
		infoQuery.setString(3,bookorder.getPhone());
		infoQuery.setString(4,bookorder.getCreditcard());
		infoQuery.setString(5,bookorder.getAddress());
		infoQuery.setDouble(6,bookorder.getTotal());
		infoQuery.executeUpdate();
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			DBcon.closeConnection(conn);
			DBcon.closeStatement(infoQuery);
		}
		
	}

}
